feat(CI): extract JSON from CLI output for downstream usage#21
Closed
Cristian-Vogel wants to merge 1 commit intocrabnebula-dev:mainfrom
Closed
feat(CI): extract JSON from CLI output for downstream usage#21Cristian-Vogel wants to merge 1 commit intocrabnebula-dev:mainfrom
Cristian-Vogel wants to merge 1 commit intocrabnebula-dev:mainfrom
Conversation
…HUB_OUTPUT. Added a TL;DR to help understand the how and why of this wrapper. Bumped semver, no breaking changes.
|
Please review this file for insight into how to properly manage changes: |
beanow-at-crabnebula
requested changes
Mar 9, 2026
Comment on lines
+110
to
+127
| # Try to extract JSON from the output | ||
| if JSON=$(echo "$OUTPUT" | sed -n '/^{/,/}/p' | jq -c '.' 2>/dev/null); then | ||
| if [ -n "$JSON" ]; then | ||
| echo "release<<nEOFn" >> $GITHUB_OUTPUT | ||
| echo "$JSON" >> $GITHUB_OUTPUT | ||
| echo "nEOFn" >> $GITHUB_OUTPUT | ||
|
|
||
| ID=$(echo "$JSON" | jq -r '.id // empty') | ||
| if [ -n "$ID" ]; then | ||
| echo "release-id=$ID" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| VERSION=$(echo "$JSON" | jq -r '.version // empty') | ||
| if [ -n "$VERSION" ]; then | ||
| echo "release-version=$VERSION" >> $GITHUB_OUTPUT | ||
| fi | ||
| fi | ||
| fi |
Member
There was a problem hiding this comment.
This assumes the stdout will contain valid JSON. And the only type ever returned is a release object.
That's very limiting in terms of features the CLI could implement. So supporting output variables should be done by the CLI, which is aware of what outputs are supposed to be generated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes
*
release: The full JSON object of the release.*
release-id: The unique identifier of the created release.*
release-version: The version string of the release.Added a TL;DR to help understand the how and why of this wrapper.
Bumped semver, no breaking changes.